﻿@model IEnumerable<LunchCommand.Models.Lunch>

@{
    ViewBag.Title = "Historic Lunches";
}

<h2>Past Lunches</h2>

<table class="table">
    <tr>
        <th>
            Date
        </th>
        <th>
            Venue
        </th>
        <th>
            Quicker Venue
        </th>
        <th>
            Splinter Faction Venue
        </th>
        <th>
            Total Lunchers
        </th>
        <th>
            % Happy
        </th>
        <th>
            % Unhappy
        </th>
    </tr>

@foreach (var item in Model.Where(m=>m.UsersGoing.Any() && m.LunchTime < DateTime.Now)) {
    <tr>
        <td>
            @item.LunchTime.ToShortDateString()
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Venue.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.QuickVenue.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DissentingVenue.Name)
        </td>
        <td>
            @item.UsersGoing.Count()
        </td>
        <td>
            @item.PercentOfUsersAgreeing.GetValueOrDefault(0)%
        </td>
        <td>
            @item.PercentOfUsersDissenting.GetValueOrDefault(0)%
        </td>
    </tr>
}

</table>
